/**
  ******************************************************************************
  * @file    download.h 
  * @author  
  * @version V1.0.0
  * @date   
  * @brief   This file provides all the headers of the common functions.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DOWNLOAD_H
#define __DOWNLOAD_H

typedef struct{
    uint8_t  head[4];              //文件头，固定为FOTA
    uint32_t size;                 //文件大小，从data开始计算
    uint8_t  encrytype;            //是否加密
    uint8_t  img_name[16];         //镜像名称  
    uint8_t  img_version[3];       //镜像版本
    uint32_t img_load_address;     //镜像加载地址
    uint8_t  sign[16];             //签名，默认使用MD5计算
}ota_file_header_t;

#if 0
   Flash0  256KBytes 0x00080000
         0x00080000-0x0008FFFF     64KBytes
			   0x00090000-0x0009FFFF
			   0x000A0000-0x000AFFFF
			   0x000B0000-0x000BFFFF
	
   Flash1  256KBytes 0x000C0000
         0x000C0000-0x000CFFFF
			   0x000D0000-0x000DFFFF
			   0x000E0000-0x000EFFFF
			   0x000F0000-0x000FFFFF
#endif

#define BOOTLOADER_ADDR         0x00080000
#define APP1_ADDR               0x00090000
#define APP2_ADDR               0x000A0000

#define BOOTLOADER_INFO_ADDR    (0x000B0000)

int8_t download_via_serial(void);
int8_t download_via_can(void);

#endif  /* __DOWNLOAD_H */

/************************END OF FILE**********************/
